package chixing.day04;

import chixing.day03.ArrayDemo;

import java.util.ArrayList;

public class ZuoYe04 {
    public static int[] problemSort(int[] a, int[] b) {
        int[] c = new int[a.length + b.length];
        for (int i = 0; i < a.length; i++) {
            c[i] = a[i];
        }
        for (int i = 0; i < b.length; i++) {
            c[a.length + i] = b[i];
        }
        ArrayDemo.bubboSort(c);
        return c;
    }
    public static ArrayList<Integer> removeRepeat(int[] a, int[] b) {
        int[] c = new int[a.length + b.length];
        for (int i = 0; i < a.length; i++) {
            c[i] = a[i];
        }
        for (int i = 0; i < b.length; i++) {
            c[a.length + i] = b[i];
        }
        for (int i = 0; i < c.length; i++) {
            for (int j = i + 1; j < c.length; j++) {
                if (c[i] == c[j]) {
                    c[j]=0;
                    }
                }
            }
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < c.length; i++) {
            if (c[i] != 0) {
                list.add(c[i]);
            }
        }
        return list;
        }

    public static void main(String[] args) {
         int[] a ={46 , 49 , 75, 80, 15, 46, 29, 58 , 80 ,46};
         int[] b ={46 , 49 , 75, 80, 15,29, 58 };
        ArrayList<Integer> ints = removeRepeat(a, b);
        for (int i = 0; i < ints.size(); i++) {
            System.out.println(ints.get(i));
        }
        }
    }
